package com.welab.springcloud.demo.common.autoConfiguration;

import com.welab.springcloud.demo.common.exception.GlobalExceptionHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
public class GlobalDefaultConfiguration {

    @Bean
    @Order(-4)
    @ConditionalOnMissingBean
    @ConditionalOnWebApplication
    public GlobalExceptionHandler exceptionHandler() {
        return new GlobalExceptionHandler();
    }

}
